<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //获得1 ~ 3 之间的随机数
        function getRandom(min, max) {
            return Math.floor(Math.random() * (max - min + 1)) + min
        }
        while(true) {
            var randomNum = getRandom(1, 3)
            var num = +prompt(`请输入1.石头, 2.剪刀, 3.布`)
            var com = ['0','石头', '剪刀', '布']
            alert(`电脑出的是：${com[randomNum]}`)
            if(num == randomNum) {
                alert('平局')
                continue
            }
            if(num == 1 && randomNum == 2) {
                alert('你赢了')
                continue
            } else {
                alert('你输了')
                continue
            }
            if(num == 2 && randomNum == 3) {
                alert('你赢了')
                continue
            } else {
                alert('你输了')
                continue
            }
            if(num == 3 && randomNum == 1) {
                alert('你赢了')
                continue
            } else {
                alert('你输了')
                continue
            }
        }
    </script>
</head>
<body>
    
</body>
</html>